package com.grm.common.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * desc: 密码工具类
 *
 * @author gaorimao
 * @since 2023-10-27-10:17
 */
public class PasswordUtils {

    private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

    // 加密密码
    public static String encryptPassword(String password) {
        return encoder.encode(password);
    }

    // 校验密码
    public static boolean checkPassword(String plainPassword, String hashedPassword) {
        return encoder.matches(plainPassword, hashedPassword);
    }
}


